package com.example.jiemian;

import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class loginActivity extends AppCompatActivity implements View.OnClickListener {
    private Button btn_anniu,btn_anniu2;
    private EditText editText;
    private Handler handler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        //查找按钮ID
        btn_anniu=(Button)findViewById(R.id.login_button_log);
        btn_anniu2=(Button)findViewById(R.id.login_button_res);
        editText=(EditText)findViewById(R.id.login_edit_content);
        //按钮添加事件
        btn_anniu.setOnClickListener(this);
        btn_anniu2.setOnClickListener(this);
    }

    @Override
    public void onClick(View v){
        switch (v.getId()) {
            case R.id.login_button_log:
                //获取文本框内容
                String context = editText.getText().toString();
                //对获取内容应用
                if (context.isEmpty()) {
                    //提示语
                    Toast.makeText(this, "内容不能为空", Toast.LENGTH_LONG).show();
                }else {
                    Intent intent = new Intent(loginActivity.this, indexActivity.class);
                    startActivity(intent);
                    finish();
                }
                break;
            case R.id.login_button_res:
                Intent intent = new Intent(loginActivity.this, resActivity.class);
                startActivity(intent);
                finish();

                break;
        }
    }

}
